package com.web.exiaodao.business.repository;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.web.exiaodao.business.entity.Shop;

import java.util.Collection;
import java.util.List;


public interface ShopRepository extends
		PagingAndSortingRepository<Shop, Long>,
		JpaSpecificationExecutor<Shop> {

	public Shop findById(Long id);
	public Shop findByIdAndStatusNot(Long id,Integer status);

	@Query(value = "SELECT COUNT(*) FROM tb_xa_shop  WHERE category_type = ?1 AND status <> ?2 ", nativeQuery = true)
	public Long findShopCountByCategoryIdAndStatusNot(Long categoryId,Integer status);

	public List<Shop> findByIdInAndStatus(Collection<Long> id, Integer status);
}
